<template>
    <view class="module-container">
        
        <view class="mb10" :body-style="{ padding: '10px 20px' }">
<view class="appointmentInfoHead flex" @click="jumpInfoPage()">
			<image :src="classroomInfo.laboratoryPic" v-if="classroomInfo.laboratoryPic" class="classRoomImg"></image>
			<image src="../../static/images/classroomPic.png" v-else class="classRoomImg"></image>
			<view class="appointmentInfoHeadBox">
				<view class="appointmentInfoHead-title txtOverFlow">
					{{classroomInfo.laboratoryName}}
					<!-- <text v-if="classroomInfo.shareOrderCount < classroomInfo.minPersonCount">（空闲中）</text>
					<text v-else-if="classroomInfo.shareOrderState == 10 ">（待开放）</text>
					<text v-else-if="classroomInfo.shareOrderState == 20">（使用中）</text> -->
				</view>
				<view class="appointmentInfoHead-subTxt flex">
					<text>位置：</text>
					<text class="ftc6">{{classroomInfo.roomLocation}}</text>
				</view>
				<view class="appointmentInfoHead-subTxt flex">
					<text>简介：</text>
				</view>
				<view class="appointmentInfoHead-subTxt flex" style="margin-bottom:15rpx">
					<text>{{((classroomInfo.laboratoryExplain||'')+' ').replace(/\n/g,'')||''}}</text>
				</view>
			</view>
			<image src="../../static/images/moreIconHui.png" class="moreIconHui"></image>
		</view>
            <div style="text-align:center;font-size: 14px;line-height: 14px;font-weight: bold;margin-top: 10px;">当前日期：{{ currentDay }}</div>
            <div
                style="display: -webkit-flex;display: flex;align-items:center; align-content:center;justify-content:center;">
                <button type="primary" size="small" @click="preWeek" style="font-size: 12px;background: linear-gradient(90deg, #19AD78, #1EBE85);">上一周</button>
                <div style="width:250px"></div>
                <button type="primary" size="small" @click="nextWeek" style="font-size: 12px;background: linear-gradient(90deg, #19AD78, #1EBE85);">下一周</button>
            </div>
        </view>
        <scroll-view v-if="classroomInfo.timeList && classroomInfo.timeList.length > 0" class="mb10" :body-style="{ padding: '10px 20px' }">
            <div class='class-table'>
                <div class='table-wrapper'>
                    <div class='tabel-container'>
                        <table>
                            <thead>
                                <tr>
                                    <th>时间</th>
                                    <th v-for='(item, index) in classroomInfo.dateTimeList' :key='index'>
                                        <p>{{ item.week }}</p>
                                        <p class='period'>{{ item.date.substr(5) }}</p>
                                    </th>
                                </tr>
                            </thead>
                            <tbody v-if="classroomInfo.timeList.length != 0">
                                <tr v-for='(temp, jdx) in classroomInfo.timeList' :key='jdx'>
                                    <td>
                                        <p>{{ temp.timeSt }}</p>
                                        <p>{{ temp.timeEn }}</p>
                                    </td>
									<td v-for='(item, index) in classroomInfo.dateTimeList' :key='index'>
									    <view class="mainRUl-li tipsOrange" v-if="item.timeList[jdx].used == 1"></view>
									    <view class="mainRUl-li tipsOrange"
									    	v-else-if="item.isHoliday >= 1 && classroomInfo.canUseInHoliday==0"
									    	@click="holidayNotUse()"><!--节假日不可用而且这一天是节假日--></view>
									    <view class="mainRUl-li tipsHui"
										@click="chooseOldDate"
									    	v-else-if="item.date < currDate || (item.date == currDate && currTime>temp.timeSt)"></view>
									    <view class="mainRUl-li tipsOpen" v-else-if="temp.isOpen"></view>
									    <view class="mainRUl-li "
									    	:class="{'tipsHui':((item.timeList[jdx].isChoose==2 || !item.timeList[jdx].isChoose)),'tipsOrange':(item.timeList[jdx].isChoose == 1)}"
									    	v-else @click="chooseTimenew(item.date,index,jdx)"></view>
									</td>
                                </tr>
                            </tbody>
                            <tbody v-else>
                                <td colspan="8">
                                    <el-empty :image-size="200"></el-empty>
                                </td>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
			<view class="footer-tips">
				<view class="tipsBox flex">
					<view class="tipsTxt">预约说明：</view>
					<view class="tipsItem flex">
						<view class="tipsHui tipsColor"></view>
						<view>可选</view>
					</view>
					<!-- <view class="tipsItem flex ">
					<view class="tipsOrange tipsColor"></view>
					<view>已选</view>
				</view> -->
					<view class="tipsItem flex">
						<view class="tipsOrange tipsColor"></view>
						<view>已约</view>
					</view>
					<view class="tipsItem flex">
						<view class="tipsOpen tipsColor"></view>
						<view>开放</view>
					</view>
				</view>
				<view class="selectedTimeBox">
					<block v-if="classroomInfo.isPositionAppointment == 1 && userChoosePosition==2">
						<view class="selectedTimeTxt">已选时间（{{chooseSiteList.length}}）</view>
						<block v-if="chooseSiteList.length > 0">
							<view class="selectedTimeItem" v-for='item,index in chooseSiteList'>
								<view>{{item.timeSt}}-{{item.timeEn}}</view>
								<view>{{item.siteName}}</view>
							</view>
						</block>
						<view class="noDataTxt" v-else>暂未选择时间</view>
					</block>
					<block v-else>
						<view class="selectedTimeTxt">已选时间（{{chooseTimeList.length}}）</view>
						<block v-if="chooseTimeList.length > 0">
							<view class="selectedTimeItem" v-for='item,index in chooseTimeList'>
								<view>{{item.timeSt}}-{{item.timeEn}}</view>
								<view>{{item.dateStr}}</view>
							</view>
						</block>
						<view class="noDataTxt" v-else>暂未选择时间</view>
					</block>
				</view>
			</view>
        </scroll-view>
        <!-- 选择教室 -->
       
	   <view class="submitBtnBox">
	   	<view class="submitBtn" style="font-size: 26rpx;" @click="showPop()">提交预约</view>
	   </view>
	   
	   <uni-popup ref="popup" :mask-click="false">
	   	<view class="popBox">
	   		<view class="popTitle">请填写以下信息</view>
	   		<!-- 原来的使用说明是手动写的-->
	   		<!-- 下面改成选荐的 -->
	   		<view style="height: 35px;" v-if="isShow">
	   			团队名称：
	   		</view>
	   		<input v-model="teamName" v-if="isShow" placeholder=""
	   			style="border-bottom: 1px solid #dedede;width:80%;" />
	   
	   		<view style="height: 35px;margin-top:10px;">
	   			预约目的：
	   		</view>
	   
	   		<radio-group @change="changeRemark" v-if='userChoosePosition==1&& roomType==0'
	   			style="overflow: hidden;">
	   			<!--整间预约的备注-->
	   			<label class="uni-list-cell uni-list-cell-pd flex radioLabel"
	   				v-for="(itemRemark,idxRemark) in classRoomAppointRemark" :key="idxRemark"
	   				v-if="itemRemark.remarkId !='remark-82F591E82B4E882B' ">
	   				<view>
	   					<radio :value="itemRemark.remarkId" color='#19AD78'
	   						:checked="itemRemark.remarkId == userChooseRemarkId" />
	   				</view>
	   				<view>{{itemRemark.remarkContent}}</view>
	   			</label>
	   			<div style="width:100%;height:5px;clear:both;"></div>
	   			<label class="uni-list-cell uni-list-cell-pd flex radioLabel" style="width:100%">
	   				<view>
	   					<radio :value="otherId" color='#19AD78' :checked="otherId == userChooseRemarkId" />
	   				</view>
	   				<view style="width:80%;">
	   					<label style="float:left;line-height: 30px;">其他：</label>
	   					<input v-model="otherRemark" maxlength="20"
	   						style="width:70%;float: left;;border: 1px solid #dedede;border-radius: 5px;height: 30px;line-height: 30px;" />
	   				</view>
	   			</label>
	   		</radio-group>
	   		<radio-group @change="changeRemark" v-if='roomType==1' style="overflow: hidden;">
	   			<!--朗读亭预约的备注-->
	   			<label class="uni-list-cell uni-list-cell-pd flex radioLabel" style="float:left;"
	   				v-for="(itemRemark,idxRemark) in readingBoothAppointRemark" :key="idxRemark"
	   				v-if="itemRemark.remarkId !='remark-82F591E82B4E882B' ">
	   				<view>
	   					<radio :value="itemRemark.remarkId" color='#19AD78'
	   						:checked="itemRemark.remarkId == userChooseRemarkId" />
	   				</view>
	   				<view>{{itemRemark.remarkContent}}</view>
	   			</label>
	   			<div style="width:100%;height:5px;clear:both;"></div>
	   			<label class="uni-list-cell uni-list-cell-pd flex radioLabel" style="width:100%">
	   				<view>
	   					<radio :value="otherId" color='#19AD78' :checked="otherId == userChooseRemarkId" />
	   				</view>
	   				<view style="width:80%;"><label style="float:left;">其他：</label>
	   					<input v-model="otherRemark" maxlength="20"
	   						style="width:80%;float: left;;border: 1px solid #dedede;border-radius: 5px;" />
	   				</view>
	   			</label>
	   		</radio-group>
	   
	   		<radio-group @change="changeRemark" v-if='userChoosePosition==2 && roomType==0'
	   			style="overflow: hidden;">
	   			<!--位置预约的备注-->
	   			<label class="uni-list-cell uni-list-cell-pd flex radioLabel"
	   				v-for="(itemRemark,idxRemark) in positionAppointRemark" :key="idxRemark">
	   				<view>
	   					<radio :value="itemRemark.remarkId" color='#19AD78'
	   						:checked="itemRemark.remarkId == userChooseRemarkId" />
	   				</view>
	   				<view>{{itemRemark.remarkContent}}</view>
	   			</label>
	   			<div style="width:100%;height:5px;clear:both;"></div>
	   			<label class="uni-list-cell uni-list-cell-pd flex radioLabel" style="width:100%">
	   				<view>
	   					<radio :value="otherId" color='#19AD78' :checked="otherId == userChooseRemarkId" />
	   				</view>
	   				<view style="width:80%;"><label style="float:left;">其他：</label>
	   					<input v-model="otherRemark" maxlength="20"
	   						style="width:80%;float: left;;border: 1px solid #dedede;border-radius: 5px;" />
	   				</view>
	   			</label>
	   		</radio-group>
	   
	   		<view style="height: 35px;margin-top:10px;" v-if="roomType==0 && !isTeachPurpose">
	   			预约主题：
	   		</view>
	   		<input v-model="topicName" placeholder=""
	   			style="border-bottom: 1px solid #dedede;width:80%;margin-bottom:20px;" v-if="roomType==0" />
	   
	   		<view style="height: 35px;margin-top:10px;" v-if="isTeachPurpose ">
	   			课程名称：
	   		</view>
	   		<input v-model="courseName" placeholder=""
	   			style="border-bottom: 1px solid #dedede;width:80%;margin-bottom:20px;" v-if="isTeachPurpose " />
	   		
	   		<view style="height: 35px;margin-top:10px;" v-if="isTeachPurpose ">
	   			学时：
	   		</view>
	   		<input v-model="courseHour" placeholder=""
	   			style="border-bottom: 1px solid #dedede;width:80%;margin-bottom:20px;" v-if="isTeachPurpose " />
	   	
	   		<view style="height: 35px;margin-top:10px;" v-if="isTeachPurpose ">
	   			班级：
	   		</view>
	   		<input v-model="className" placeholder=""
	   			style="border-bottom: 1px solid #dedede;width:80%;margin-bottom:20px;" v-if="isTeachPurpose " />
	   		<view style="height: 35px;margin-top:10px;" v-if="isTeachPurpose ">
	   			人数：
	   		</view>
	   		<input v-model="peopleNumber" placeholder=""
	   			style="border-bottom: 1px solid #dedede;width:80%;margin-bottom:20px;" v-if="isTeachPurpose " />
	   
	   
	   		<view class="flex">
	   			<button @click="closePop()" class="popBtn">关闭</button>
	   			<button @click="surePop()" class="popBtn">确认</button>
	   		</view>
	   	</view>
	   </uni-popup>
	   <uni-popup ref="choosePositionOrWayPop" :mask-click="false">
	   	<view class="popBox" style="margin: 40rpx;">
	   		<view class="popTitle">请选择预约方式</view>
	   		<radio-group @change="changeCheck">
	   			<label class="uni-list-cell uni-list-cell-pd flex radioLabel"
	   				v-for="(item,idx) in positionWayChooseList" :key="idx">
	   				<view>
	   					<radio :value="item.value" color='#19AD78' :checked="item.value == userChoosePosition" />
	   				</view>
	   				<view>{{item.name}}{{item.tips}}</view>
	   			</label>
	   		</radio-group>
	   		<view class="flex">
	   			<button @click="sureChoosePop()" class="popBtn">确定</button>
	   		</view>
	   	</view>
	   </uni-popup>

    </view>
</template>
  
<script>

export default {
    data() {
        return {
			currLaboratoryId: '',
			roomType: 0,
            searchForm: {
                laboratoryName: '',
                week: 0,
                classroomId: ''
            },
			classroomInfo: {},
            token: getApp().globalData.token,
            weeks: [],
            classTableData: [],
            currentDay: '',
            classroomDialog: false,
            isRouterAlive: true,
            tableShow: false,
            timeList: [],
            // 其他研讨目的
            isOtherdiscuss: true,
            isShow: false,
            isStripe: false,
            ischecked: false,
            isShowMember: true,
            memberSuject: 'memberSuject',
            memberMan: 'memberMan',
            memberList: [], // 会员数据
            checkedmember: {}, // 当前选中的一行会员
            member_count: 0, // 总数
            member_page: 1, // 当前页
            member_size: 5,
            formMc: {
                memberName: '',
                memberNumber: ''

            },
			//整间预约可选择的备注原因列表
			classRoomAppointRemark: [],
			//朗读亭预约可选择的备注原因列表
			readingBoothAppointRemark: [],
			//位置预约可选择的备注原因列表
			positionAppointRemark: [],
			//共享预约可选择的备注原因列表
			shareAppointRemark: [],
			courseName: '',
			className: '',
			courseHour: '',
			peopleNumber: '',
			positionWayChooseList: [{
				name: '整间预约：',
				value: '1',
				tips: ''
			}, {
				name: '位置预约：',
				value: '2',
				tips: ''
			}],
            setColor: {
                gray: 'gray',
                green: 'green',
                orange: 'orange',
                red: 'red',
                // greenOpen: '#18cca7',
                greenOpen: '#67C23A',
                SkyBlue: '#0099ff'
            },
            memberForm: {
                memberName: '',
                memberName2: '',
                memberOther: '',
                memberGoal: '',
                memberSuject: '',
                memberMan: '',
                courseHour: '',
                className: '',
                peopleNumber: '',
                courseName: ''
            },
			teamName: '', //团队名称
			topicName: '', //预约主题
			leaderName: '', //预约召集人
            memberDialogVisible: false, // 选择会员-弹框隐藏
            dialogVisible: false, // 弹框隐藏
            RemarkList: [], // 研讨目的
            collegeList: [], // 学院信息
            merchantId: '', // 当前学院id
            queryLabortoryArr: [], // 当前实验室
            laboratoryId: '', // 实验室ID
            LabortoryArr: [], // 教室预约信息List
            myrecord: [], // 记录教室laboratoryId
            dateArr: [], // 记录时间段选中的
            columns: [

            ],

            value: '',
            value2: '', //
            currentdate: '', // 当前日期
            todayTime: '',
            containerWidth: '',
            classRomminfo: {
                checkdDateTimeArr: [],
                rows: {},
                columns: {}
            },
            iscancelapppintment: false, // 是否打开取消预约的弹框
            // 时间对象
            statAndendObj: {
                startTime: '',
                endTime: ''
            },
            appointmentTimeType: 0,
            // 取消预约单选
            goods: {
                id: '',
                data: {}
            },
            editRules: {
                // memberName2: [
                //   { required: true, message: '请输入团队名称', trigger: 'blur' }
                // ],
                memberSuject: [
                    { required: true, message: '请输入研讨主题', trigger: 'blur' }
                ],
            },
			laboratoryId: '',
			classroomState: 3, //1有座位，2已满员，3使用中，4已预约
			dateList: [],
			chooseDate: '',
			chooseTimeList: [], //整个时间段选择的时间
			chooseSiteList: [], //位置选择
			isInvitation: false, //是否邀请
			scrollLeft: 0,
			orderId: '', //只有邀请的时候才有
			currDate: '',
			remarks: '', //提交使用说明
			remarkIds: '', //已选择的预约备注原因，后来客户确认只能选择一个
			otherId: 'otherId',
			otherRemark: '', //其他的备注内容
			userChoosePosition: 1,
			userChooseRemarkId: '',
        }
    },
    created() {
        this.getCourseScheduleByWeek()
    },
	computed: {
		isTeachPurpose() {
			const d = this.classRoomAppointRemark.find(v=>v.remarkContent === '教学');
			return d && this.remarkIds== d.remarkId;
		}
	},
    mounted() {
        this.onclientWidth()
        window.onresize = () => {
            const container = document.querySelector('.module-container')
            if (container) {
                this.containerWidth = container.clientWidth + 'px'
            }

        }
    },
    updated() {
        this.onclientWidth()
    },
	onLoad(options) {
		this.laboratoryId = options.laboratoryId;
		this.getAppointBaseRemark();
		this.getUserName()
		this.currLaboratoryId = options.laboratoryId;
	},
    methods: {
		//选择整间还是预约
		changeCheck: function(evt) {
			this.userChoosePosition = evt.detail.value;
		},
		changeRemark: function(evt) {
			console.log(evt.detail.value);
			if (evt.detail.value) {
				this.remarkIds = evt.detail.value;
			}
			console.log("remarkIds=" + this.remarkIds);
		},
		getUserName() {
		
			this.$utils.requestFun('/member/memberSchoolUsers/api/selectMemberUserInfoByToken', {
				token: getApp().globalData.token
			}, 'GET').then(res => {
				this.userName = res.data.data.userName;
				this.userType = res.data.data.userType;
			})
		},
		searchInfo(dateStr, isrefresh = 0, closetips = 0) {
						console.log('---')
						
						let _this = this;
						_this.chooseDate = dateStr;
		console.log('xxx')
						//刷新时间
						this.chooseTimeList = [];
						this.chooseSiteList = [];
						this.remarks = '';
						let date = new Date();
						this.currYear = date.getFullYear();
						let month = date.getMonth() + 1 >= 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1);
						let day = date.getDate() >= 10 ? date.getDate() : '0' + date.getDate();
						this.currDate = this.currYear + '-' + month + '-' + day;
		
						let hour = date.getHours() >= 10 ? date.getHours() : '0' + date.getHours();
						let minute = date.getMinutes() >= 10 ? date.getMinutes() : '0' + date.getMinutes();
						this.currTime = hour + ':' + minute;
		
						this.$utils.requestFun('/stadium/stadium/api/findLaboratoryByIdApi?routh=curriculum', {
							laboratoryId: _this.laboratoryId,
							date: dateStr,
							appId: getApp().globalData.appid,
							token: getApp().globalData.token,
							week: this.searchForm.week
						}, 'GET').then(res => {
		
							_this.classroomInfo = res.data.data;
							//不是共享空间并且不是位置预约 0否1是
							//位置和整间都被选择了，查询详情并弹框
		
							//检查默认设置
							if (isrefresh == 0) { //代表第一次调用数据
								let df_userChoosePosition = 0;
								if (_this.classroomInfo.isShare == 0 && _this.classroomInfo.appointmentWay == 1) {
									_this.userChoosePosition = 1;
								}
								if (_this.classroomInfo.isShare == 0 && _this.classroomInfo.isPositionAppointment == 1 &&
									_this.classroomInfo.appointmentWay == 0) {
									_this.userChoosePosition = 2;
								}
							}
							this.roomType = _this.classroomInfo.roomType || 0
							if (_this.classroomInfo.isShare == 0 && _this.classroomInfo.isPositionAppointment == 1 && _this
								.classroomInfo.appointmentWay == 1) {
								_this.getInfoTips('SYS005', 2); //整间预约文字说明 channelId=hnsd appCode=SYS005
								_this.getInfoTips('SYS006', 2); //位置预约文字说明 channelId=hnsd appCode=SYS006
								if (closetips == 0) { //代表第一次调用数据
									_this.$refs.choosePositionOrWayPop.open();
								}
							}
						})
					},
					//获取预约备注内容
					getAppointBaseRemark() {
						//获取预约备注内容
						let _this = this;
						this.$utils.requestFun('/stadium/baseRemark/api/queryBaseRemarkList?route=curriculum', {
							page: 1,
							limit: 99999,
							appId: getApp().globalData.appid,
							token: getApp().globalData.token
						}, 'GET').then(res => {
							console.log("预约备注列表");
							console.log(res.data.data)
							if (res.data.data) {
								const data = res.data.data.data;
								for (var i = 0; i < data.length; i++) {
									if (data[i].remarkType == 0) {
										_this.shareAppointRemark.push(data[i]);
									} else if (data[i].remarkType == 1) {
										// if(_this.userType === 0 && data[i].remarkContent === '教学') {
										// 	continue
										// }
										_this.classRoomAppointRemark.push(data[i]);
									} else if (data[i].remarkType == 2) {
										_this.positionAppointRemark.push(data[i]);
									} else if (data[i].remarkType == 3) {
										_this.readingBoothAppointRemark.push(data[i]);
									}
								}
					
								console.log("classRoomAppointRemark" + _this.classRoomAppointRemark);
					
							}
					
						})
					},
					
					
					
					//确认加入邀请
					submitInvitation() {
						let _this = this;
						this.$utils.requestFun('/stadium/laboratoryOrder/api/addLaboratoryVisiteUsers?routh=curriculum', {
							fromOrderId: _this.orderId,
							orderId: _this.orderId,
							appId: getApp().globalData.appid,
							token: getApp().globalData.token,
							remarks: _this.remarks
						}, 'GET').then(res => {
							let timeStr = _this.chooseDate;
							uni.showToast({
								title: '加入邀请成功!',
								success() {
									setTimeout(() => {
										uni.navigateTo({
											url: '/pages/appointmentInfo/appointmentInfo?orderId=' +
												_this.orderId,
										});
										/* 
										uni.redirectTo({
											url: '/pages/appointmentSuccess/appointmentSuccess?flag=2&name='+_this.classroomInfo.laboratoryName+
											'&time='+timeStr+'&location='+_this.classroomInfo.roomLocation+'&orderId='+_this.orderId
										});
										*/
									}, 1000)
								}
							})
						})
						uni.removeStorageSync('orderId');
					},
		dateFormat(date, format) {
			if (typeof date === "string") {
			  var mts = date.match(/(\/Date\((\d+)\)\/)/);
			  if (mts && mts.length >= 3) {
			    date = parseInt(mts[2]);
			  }
			}
			date = new Date(date);
			if (!date || date.toUTCString() == "Invalid Date") {
			  return "";
			}
			var map = {
			  "M": date.getMonth() + 1, //月份 
			  "d": date.getDate(), //日 
			  "h": date.getHours(), //小时 
			  "m": date.getMinutes(), //分 
			  "s": date.getSeconds(), //秒 
			  "q": Math.floor((date.getMonth() + 3) / 3), //季度 
			  "S": date.getMilliseconds() //毫秒 
			};
						
			format = format.replace(/([yMdhmsqS])+/g, function (all, t) {
			  var v = map[t];
			  if (v !== undefined) {
			    if (all.length > 1) {
			      v = '0' + v;
			      v = v.substr(v.length - 2);
			    }
			    return v;
			  } else if (t === 'y') {
			    return (date.getFullYear() + '').substr(4 - all.length);
			  }
			  return all;
			});
			return format;
		},
        onclientWidth() {
            const container = document.querySelector('.module-container')
            if (container) {
                this.containerWidth = container.clientWidth + 'px'
            }
        },
        getWeekBydate(timestr) {
			var time = timestr || null
			  var date = new Date(time)
			  switch (date.getDay()) {
			    case 1:
			      return '周一'
			    case 2:
			      return '周二'
			    case 3:
			      return '周三'
			    case 4:
			      return '周四'
			    case 5:
			      return '周五'
			    case 6:
			      return '周六'
			    case 0:
			      return '周日'
			
			    default:
			
			      break
			  }
		},
        /**
            * 数字转中文
            * @param {Number} num 需要转换的数字
            * @param {String} identifier 标识符
            * @returns {String} 转换后的中文
            */
        digital2Chinese(num, identifier) {
            const character = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二']
            return identifier === 'week' && (num === 0 || num === 7) ? '日' : character[num]
        },
        // vue组件重新加载（刷新）
        reload() {
            this.isRouterAlive = false
            this.$nextTick(() => (this.isRouterAlive = true))
        },
        refreshData() {

        },
		chooseOldDate() {
			uni.showToast({
				title: '不可选择过去时间段',
				icon: 'none'
			});
		},
		//整个时间段，选择时间
		chooseTimenew(day, idx, idy) {
		
			if (this.isInvitation) {
				return;
			}
		
			if (day != this.chooseDate) { //不是同一天的时间段，清空之前的选择
		
				for (let i = 0; i < this.chooseTimeList.length; i++) {
					this.classroomInfo.dateTimeList[this.chooseTimeList[i].datekey1]['timeList'][this.chooseTimeList[i]
						.datekey2
					].isChoose = 2
				}
				this.chooseTimeList = [];
		
			}
		
			this.chooseDate = day;
		
			let data = this.classroomInfo.dateTimeList[idx]['timeList'][idy];
			let isChoose = this.classroomInfo.dateTimeList[idx]['timeList'][idy].isChoose;
		
		
		
		
		
			//this.classroomInfo.dateTimeList[idx]['timeList'][idy].isChoose = (isChoose == undefined || isChoose==2) ? 1 : 2;
		
			this.$set(this.classroomInfo.dateTimeList[idx]['timeList'][idy], 'isChoose', (isChoose == undefined ||
				isChoose == 2) ? 1 : 2)
		
		
			if (this.classroomInfo.dateTimeList[idx]['timeList'][idy].isChoose == 1) {
				data.dateStr = this.classroomInfo.dateTimeList[idx].date;
				data.datekey1 = idx;
				data.datekey2 = idy;
		
				if (this.classroomInfo.projectDuration == 1) {
					if (this.chooseTimeList.length >= this.classroomInfo.maxOrderTime) {
						uni.showToast({
							title: '最长可预约' + this.classroomInfo.maxOrderTime + '小时',
							icon: 'none'
						});
						this.$set(this.classroomInfo.dateTimeList[idx]['timeList'][idy], 'isChoose', 2);
		
						return;
					}
				}
				if (this.classroomInfo.projectDuration == 0.5) {
					if (this.chooseTimeList.length * 0.5 >= this.classroomInfo.maxOrderTime) {
						uni.showToast({
							title: '最长可预约' + this.classroomInfo.maxOrderTime + '小时',
							icon: 'none'
						});
						this.$set(this.classroomInfo.dateTimeList[idx]['timeList'][idy], 'isChoose', 2);
						return;
					}
				}
		
		
		
				this.chooseTimeList.push(data);
				console.log('chooseTimeList', this.chooseTimeList);
			} else {
				if (this.chooseTimeList.length > 0) {
					for (let i = 0; i < this.chooseTimeList.length; i++) {
						if (this.chooseTimeList[i].timeSt == data.timeSt &&
							this.chooseTimeList[i].timeEn == data.timeEn) {
							this.chooseTimeList.splice(i, 1);
							break;
						}
					}
				}
			}
		
		},
        // 判断时间是否过期

        isguoqi(date) {
            if (date) {
                const str = date
                return new Date().getTime() > new Date(str).getTime()
            }
        },
        // 判断时间是否开放
        isKaiFang(uten) {
            if (uten.isOpen == 1) {
                return true
            } else {
                return false
            }
        },
        // 单选 会员
        changeRedio(event, row) {
            console.log('event,row:', event, row)
            this.checkedmember = row
        },
        // 关闭弹框
        closeDialg() {
            this.resetForm('memberForm') // 教室预约-重置表单数据
            this.classRomminfo = {
                checkdDateTimeArr: [],
                rows: {},
                columns: {}
            }
            // this.restTimequantum()// 重置时间

            this.dialogVisible = false
        },
        // 选择教室
        classroomAffirm() {
            this.searchForm.classroomId = this.$refs.classroomRef.radio.laboratoryId
            this.searchForm.laboratoryName = this.$refs.classroomRef.radio.laboratoryName
            this.classroomDialog = false
            this.reload()
            this.searchForm.week = 0
            this.getCourseScheduleByWeek()
        },
        preWeek() {
            this.searchForm.week = this.searchForm.week - 1
            this.getCourseScheduleByWeek()
        },
        nextWeek() {
            this.searchForm.week = this.searchForm.week + 1
            this.getCourseScheduleByWeek()
        },
        getCourseScheduleByWeek() {
            const that = this
            this.$utils.requestFun('/curriculum/curriculumStudy/api/getBackCourseScheduleByWeek', {
                    token: that.token,
                    classroomId: this.laboratoryId,
					week: this.searchForm.week
                })
                .then(res => {
                    const tableData = res.data.data
                    this.weeks = res.data.data.weekList
                    this.currentDay = res.data.data.currentDay
                    this.classTableData = res?.data.data?.tableData ?? []
					this.searchInfo(this.currentDay)
                    console.log('tableData==', tableData)
                })
        },
        // 阿拉伯数字转换为简写汉字
        Arabia_To_SimplifiedChinese(Num) {
            for (let i = Num.length - 1; i >= 0; i--) {
                Num = Num.replace(',', '')// 替换Num中的“,”
                Num = Num.replace(' ', '')// 替换Num中的空格
            }
            if (isNaN(Num)) { // 验证输入的字符是否为数字
                // alert("请检查小写金额是否正确");
                return
            }
            // 字符处理完毕后开始转换，采用前后两部分分别转换
            const part = String(Num).split('.')
            let newchar = ''
            // 小数点前进行转化
            for (let i = part[0].length - 1; i >= 0; i--) {
                if (part[0].length > 10) {
                    // alert("位数过大，无法计算");
                    return ''
                }// 若数量超过拾亿单位，提示
                let tmpnewchar = ''
                const perchar = part[0].charAt(i)
                switch (perchar) {
                    case '0': tmpnewchar = '零' + tmpnewchar
                        break
                    case '1': tmpnewchar = '一' + tmpnewchar
                        break
                    case '2': tmpnewchar = '二' + tmpnewchar
                        break
                    case '3': tmpnewchar = '三' + tmpnewchar
                        break
                    case '4': tmpnewchar = '四' + tmpnewchar
                        break
                    case '5': tmpnewchar = '五' + tmpnewchar
                        break
                    case '6': tmpnewchar = '六' + tmpnewchar
                        break
                    case '7': tmpnewchar = '七' + tmpnewchar
                        break
                    case '8': tmpnewchar = '八' + tmpnewchar
                        break
                    case '9': tmpnewchar = '九' + tmpnewchar
                        break
                }
                switch (part[0].length - i - 1) {
                    case 0: tmpnewchar = tmpnewchar
                        break
                    case 1: if (perchar != 0) tmpnewchar = tmpnewchar + '十'
                        break
                    case 2: if (perchar != 0) tmpnewchar = tmpnewchar + '百'
                        break
                    case 3: if (perchar != 0) tmpnewchar = tmpnewchar + '千'
                        break
                    case 4: tmpnewchar = tmpnewchar + '万'; break
                    case 5: if (perchar != 0) tmpnewchar = tmpnewchar + '十'
                        break
                    case 6: if (perchar != 0) tmpnewchar = tmpnewchar + '百'
                        break
                    case 7: if (perchar != 0) tmpnewchar = tmpnewchar + '千'
                        break
                    case 8: tmpnewchar = tmpnewchar + '亿'
                        break
                    case 9: tmpnewchar = tmpnewchar + '十'
                        break
                }
                newchar = tmpnewchar + newchar
            }
            // 替换所有无用汉字，直到没有此类无用的数字为止
            while (newchar.search('零零') != -1 || newchar.search('零亿') != -1 || newchar.search('亿万') != -1 || newchar.search('零万') != -1) {
                newchar = newchar.replace('零亿', '亿')
                newchar = newchar.replace('亿万', '亿')
                newchar = newchar.replace('零万', '万')
                newchar = newchar.replace('零零', '零')
            }
            // 替换以“一十”开头的，为“十”
            if (newchar.indexOf('一十') == 0) {
                newchar = newchar.substr(1)
            }
            // 替换以“零”结尾的，为“”
            if (newchar.lastIndexOf('零') == newchar.length - 1) {
                newchar = newchar.substr(0, newchar.length - 1)
            }
            return newchar
        },
        // 点击单元格
        cellChange(item, date, has, orderId) {
            const uten = {
                longTime: date + ' ' + item.startTime + '~' + item.endTime,
                has: has,
                orderId: orderId || ''
            }
            console.log(uten)
            // 判断当前操作是选中还是取消
            if (!this.handler(this.dateArr, uten)) {
                console.log('选中')
                this.dateArr.push(uten)
                // this.handlerhightlight(this.dateArr, 'orange')
            } else {
                console.log('取消')
                this.handlerspliceArr(this.dateArr, uten)
                // this.handlerhightlight(id, 'green')
                // if (utens.invalid == null && utens.orderDetailList.length !== 0) {
                //     this.handlerhightlight(id, '#0099ff')
                // }
            }

            console.log('dateArr', this.dateArr)

            this.classRomminfo = Object.assign(this.classRomminfo, { checkdDateTimeArr: this.dateArr }, { rows: item }, { columns: uten })
        },
        handler(arr, item) {
            let a = false
            arr.forEach(res => {
                if (res.longTime == item.longTime) {
                    a = true
                }
            })
            return a
        },
        // 删除取消的一项
        handlerspliceArr(arr, uten) {
            arr.forEach(res => {
                if (res.longTime == uten.longTime) {
                    const index = arr.findIndex((item) => item.longTime == uten.longTime)

                    // this.handlerhightlight(res.id, 'green')
                    arr.splice(index, 1)
                }
            })
        },
        // 设置取消颜色高亮
        handlerhightlight(arr, color) {
            if (typeof arr === 'string') {
                document.getElementById(arr).style.background = color
                return false
            }
            arr.forEach(res => {
                if (res.id !== '') {
                    document.getElementById(res.id).style.background = color
                }
            })
        },
        //
        getasyncREsult() {
            this.getfindMerchantByPage()
        },

        // 当前页数size
        handleSizeChange5(val) {
            // console.log('3',val);
            this.member_size = val
            this.getMemberSchoolUserList()
        },
        // 当前页改变
        handleCurrentChange5(val) {
            // console.log('2',val);
            this.member_page = val
            this.getMemberSchoolUserList()
        },
        // 添加选中的会员
        addData() {
            if (Object.keys(this.checkedmember).length == 0) {
                this.$message.warning('请先选择一条会员！')
                return false
            }
            const { userName } = this.checkedmember
            this.memberForm.memberName = userName
            this.memberDialogVisible = false
        },
        // 监听研讨目的
        discussChange() {
            const memberOther = this.memberForm.memberOther || ''
            // 其他原因
            if (memberOther === 'otherId') {
                this.isOtherdiscuss = false
            } else {
                this.isOtherdiscuss = true
                this.memberForm.memberGoal = ''
            }
        },
        handleSelectionChange(row) {
            // console.log('row',row);
            this.checkedmember = row;

        },
        // 打开会员选择
        openSelectMember() {
            this.memberDialogVisible = true
            this.getMemberSchoolUserList()// 查询会员list
        },
        // 关闭弹框
        handleClose(done) {
            // this.$confirm('确认关闭？')
            //   .then(_ => {
            done()
            // })
            // .catch(_ => { })
        },
        // 预约
        yuyue() {
            if (this.dateArr.length == 0) {
                this.$message.warning('请选择教室时间！')
                return false
            }
            const _roomType = this.classRomminfo.rows.roomType || 0
            let _remarkType = 1
            // 朗读亭
            if (_roomType == 1) {
                _remarkType = 3
                this.isShowMember = false
                this.memberSuject = '1111'
                this.memberMan = '1111'
            } else {
                this.isShowMember = true
                this.memberSuject = 'memberSuject'
                this.memberMan = 'memberMan'
            }

            // 获取研讨目的
            this.getqueryBaseRemarkList(_remarkType)
            // // 判断是否改选中包含已选预约
            let anappointmented = false
            this.dateArr && this.dateArr.forEach(k => {
                if (k.has) {
                    anappointmented = true
                }
            })
            if (anappointmented) {
                this.$message.warning('选择已存在预约不可再次预约,请重新选择！')
                //  this.dateArr=[]
                return false
            }

            this.dialogVisible = true
        },
        // 获取教室预约的研讨目的类型
        getqueryBaseRemarkList(remarkType) {
            const params = {
                token: this.$util.cookies.get('token'),
                route: 'member',
                page: '',
                limit: '',
                remarkContent: '',
                remarkType: remarkType
            }
            this.$api.queryBaseRemarkList2(params).then(res => {
                console.log('研讨目的', res.data)
                const resData = res?.data?.data || []
                resData.push({ remarkId: 'otherId', remarkContent: '其他' })
                this.RemarkList = resData
            })
        },
        // 点击取消预约
        cancelapppintment() {
            if (Object.keys(this.classRomminfo.rows).length == 0) {
                this.$message.warning('请先选择教室！')
                return false
            }

            // 判断是否选择中包含未预约
            const anappointmented = this.dateArr.every(v => {
                return v.has
            })

            if (!anappointmented) {
                this.$message.warning('选择已存在未预约不可取消预约，请重新选择！')
                // this.dateArr=[]
                return false
            }
            this.iscancelapppintment = true
        },
        // 取消预约 --取消按钮
        cancelback() {
            //this.handlerhightlight(this.dateArr, 'red')
            this.dateArr = []
            //  this.getClassroomPositionData()
            this.iscancelapppintment = false
        },
        // 取消预约方法
        async submitCancelAppointment() {
            console.log('DDS', this.classRomminfo)
            const { checkdDateTimeArr } = this.classRomminfo

            this.dateArr = [];
            this.iscancelapppintment = false
            for (let index = 0; index < checkdDateTimeArr.length; index++) {
                const element = checkdDateTimeArr[index];
                const params = {
                    token: this.$util.cookies.get('token'),
                    orderId: element.orderId
                }
                await this.$api.laboratoryCancelOrder(params)
            }
            this.getCourseScheduleByWeek()
        },
        // 提交预约信息
        submitsInfo() {
            const userId = this.checkedmember.userId || ''
            if (userId === '') {
                this.$message.error('请选择会员！')
                return false
            }
            // 研讨目的
            const discussId = this.memberForm.memberOther || ''
            // 其他研讨目的
            const discussRemark = this.memberForm.memberGoal || ''
            if (discussId === '') {
                this.$message.error('请选择研讨目的！')
                return false
            }
            if (discussId === 'otherId' && discussRemark === '') {
                this.$message.error('请输入其他研讨目的！')
                return false
            }
            const { userType } = this.checkedmember// 选中的会员

            const memberName = this.memberForm.memberName || ''
            const memberName2 = this.memberForm.memberName2 || ''
            let _memberMan = this.memberForm.memberMan || ''
            let _memberSuject = this.memberForm.memberSuject || ''
            // const { memberSuject, memberMan, memberName2, memberName } = this.memberForm// 表单
            if (!this.isShowMember) {
                _memberMan = memberName
                _memberSuject = memberName
            }

            // console.log('rows',rows,columns);
            const { rows: { laboratoryId, laboratoryName, createTime }, checkdDateTimeArr } = this.classRomminfo

            const map = {};
            checkdDateTimeArr.forEach(item => {
                const date = item.longTime.split(' ');
                const str = date[1].split('~')
                const d = { startTime: str[0], endTime: str[1], orderId: '' };
                if (!map[date[0]]) {
                    map[date[0]] = [d]
                }
                else {
                    map[date[0]].push(d);
                }
            });

            this.$refs.editFormMember.validate((valid) => {
                if (valid) {
                    const dates = Object.keys(map);
                    const promises = [];
                    for (let index = 0; index < dates.length; index++) {
                        const date = dates[index];

                        const timeList = map[date]
                        // console.log('timeList', timeList)

                        const pointStr = [
                            {
                                laboratoryId: this.searchForm.classroomId,
                                laboratoryName: this.searchForm.laboratoryName,
                                appointmentDate: this.dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'),
                                weekDay: this.getWeekBydate(date),
                                timeList: timeList
                            }
                        ]
                        const data = {
                            token: this.$util.cookies.get('token'),
                            date: date,
                            memberType: userType,
                            userId: userId,
                            appId: 'wx6b9de9cb7e1bc6ab',
                            backRemark: '',
                            isClassroomAppointment: 1,
                            teamName: memberName2, // 团队名称
                            topicName: _memberSuject, // 研讨主题
                            leaderName: _memberMan, // 预约召集人
                            remarkIds: discussId === 'otherId' ? '' : discussId, // 研讨目的ID
                            otherRemark: discussRemark, // 其他研讨目的
                            pointStr: JSON.stringify(pointStr),
                            courseName: this.memberForm.courseName,
                            peopleNumber: this.memberForm.peopleNumber,
                            className: this.memberForm.className,
                            courseHour: this.memberForm.courseHour
                        }
                        const p = this.$api.addLaboratoryOrderBatchBack(data);
                        promises.push(p);
                    }
                    Promise.all(promises).then(res => {
                        // 重置表单
                        this.resetForm('memberForm')
                        // this.dateArr.length == 0
                        this.dateArr = [];
                        this.getCourseScheduleByWeek()

                        // this.restTimequantum()
                        this.classRomminfo = {
                            checkdDateTimeArr: [],
                            rows: {},
                            columns: {}
                        }
                        this.memberForm = {
                            memberName: '',
                            memberName2: '',
                            memberOther: '',
                            memberGoal: '',
                            memberSuject: '',
                            memberMan: '',
                            courseHour: '',
                            className: '',
                            peopleNumber: '',
                            courseName: ''
                        };
                        this.dialogVisible = false
                    })
                } else {
                    return false
                }
            })




        },
        // 重置表单数据
        resetForm(formName) {
            console.log('refs', this.$refs[formName])

            setTimeout(() => {
                this.$refs[formName].resetFields()
            }, 200)
        },
        //提交前加弹框
        showPop() {
        	if (this.isInvitation) {
        		this.submitHandler();
        		return
        	}
        	if (this.classroomInfo.isShare == 0) {
        		if (this.userChoosePosition == 2 && this.chooseSiteList.length <= 0) {
        			uni.showToast({
        				title: '请选择座位！',
        				icon: 'none'
        			});
        			return;
        		} else if (this.userChoosePosition == 1 && this.chooseTimeList.length <= 0) {
        			uni.showToast({
        				title: '请选择时间段！',
        				icon: 'none'
        			});
        			return;
        
        		}
        	}
        
        	if (this.classroomInfo.isShare == 1 && this.classroomInfo.shareOrderRemark == 1) {
        		//	是否共享空间：0否；1是， shareOrderRemark number 共享空间下单是否需要填写备注 0不需要；1需要 
        		this.$refs.popup.open();
        	} else if (this.classroomInfo.isShare == 0 && this.classroomInfo.appointmentWay == 1 && this.classroomInfo
        		.classroomOrderRemark == 1) {
        		//	是否支持整间预约：0：否 1：是，classroomOrderRemark number 整间预约下单是否需要填写备注 0不需要；1需要 
        		this.$refs.popup.open();
        	} else if (this.classroomInfo.isShare == 0 && this.classroomInfo.isPositionAppointment == 1 && this
        		.classroomInfo.positionOrderRemark == 1) {
        		//	是支持否位置预约：0：否 1：是，positionOrderRemark number 位置预约下单是否需要填写备注 0不需要；1需要 
        		this.$refs.popup.open();
        	} else {
        		// this.submitHandler();
        		this.$refs.popup.open();
        	}
        },
        //确认判断调用哪个方法
        surePop() {
        	if (this.remarkIds.length == 0 && this.userChoosePosition == 1 && this.classroomInfo
        		.classroomOrderRemark == 1) {
        		uni.showToast({
        			title: '请选择预约目的！',
        			icon: 'none'
        		})
        		return;
        	}
        	if (this.remarkIds.length == 0 && this.userChoosePosition == 2 && this.classroomInfo.positionOrderRemark ==
        		1) {
        		uni.showToast({
        			title: '请选择预约目的！',
        			icon: 'none'
        		})
        		return;
        	}
        	this.submitHandler();
        	this.$refs.popup.close();
        },
        //用来判断调用哪个提交的方法
        submitHandler() {
        	if (this.classroomInfo.isShare == 1 && this.isInvitation) {
        		this.submitAppointment();
        	} else if (this.classroomInfo.isShare == 0 && this.isInvitation) {
        		this.submitInvitation();
        	} else {
        		this.submitAppointment();
        	}
        },
        
        closePop() {
        
        	this.$refs.popup.close();
        
        },
        //提交预约
        submitAppointment() {
        	uni.removeStorageSync('orderId');
        	let _this = this;
        	let pointArr = [];
        	if (getApp().globalData.token == '') {
        		uni.showToast({
        			title: '请登录',
        			icon: 'none',
        			success() {
        				uni.navigateTo({
        					url: '/pages/login/login',
        				});
        			}
        		})
        		return;
        	}
        	let timeStr = _this.chooseDate;
        	//共享空间
        	if (this.classroomInfo.isShare == 1) {
        		this.$utils.requestFun('/stadium/laboratoryOrder/api/saveLaboratoryOrder?route=curriculum', {
        			token: getApp().globalData.token,
        			appId: getApp().globalData.appid,
        			laboratoryId: _this.currLaboratoryId,
        			fromOrderId: _this.orderId,
        			orderId: _this.orderId,
        			appointmentDate: timeStr,
        			remarks: _this.remarks
        		}, 'GET').then(res => {
        			let orderId = res.data.data;
        			/* uni.navigateTo({
        				url: '/pages/appointmentSuccess/appointmentSuccess?flag=1&name='+_this.classroomInfo.laboratoryName+'&time='+timeStr+'&location='+_this.classroomInfo.roomLocation+'&orderId='+orderId,
        			}); */
        
        			// #ifdef MP-WEIXIN
        			_this.sendMessage(orderId, timeStr, 1, 't3LKagU-8s_DaWO6qco9kjhqiCKwqVVAUcaKBHdJm4A', _this
        				.classroomInfo.roomLocation);
        			// #endif
        
        			// #ifdef H5
        			_this.sendMessage(orderId, timeStr, 1, 'YtJLqvSMVSHFYd491U8N4nf8VZqGDnTSKkJwmwL7Eqk', _this
        				.classroomInfo.roomLocation);
        			// #endif
        		})
        	} else {
        
        
        		let isClassroomAppointment = 0;
        		if (this.userChoosePosition == 2) {
        			for (let i = 0; i < this.chooseSiteList.length; i++) {
        				let obj = {
        					siteId: this.chooseSiteList[i].siteId,
        					timeSt: this.chooseSiteList[i].timeSt,
        					timeEn: this.chooseSiteList[i].timeEn,
        				}
        				pointArr.push(obj);
        			}
        			isClassroomAppointment = 0;
        		} else {
        			for (let i = 0; i < this.chooseTimeList.length; i++) {
        				let obj = {
        					timeSt: this.chooseTimeList[i].timeSt,
        					timeEn: this.chooseTimeList[i].timeEn,
        				}
        				pointArr.push(obj);
        			}
        			isClassroomAppointment = 1;
        		}
        
        
        		if (this.classroomInfo.isShare == 0 && this.classroomInfo.appointmentWay == 1 && this.classroomInfo
        			.classroomOrderRemark == 1) {
        			//	是否支持整间预约：0：否 1：是，classroomOrderRemark number 整间预约下单是否需要填写备注 0不需要；1需要 
        			if (_this.remarkIds == "otherId" && (!_this.otherRemark || _this.otherRemark == "")) {
        				uni.showToast({
        					title: '请填写其他预约目的！',
        					icon: 'none'
        				});
        				return;
        			} else if (_this.remarkIds == '') {
        				uni.showToast({
        					title: '请选择预约目的！',
        					icon: 'none'
        				});
        				return;
        			}
        		} else if (this.classroomInfo.isShare == 0 && this.classroomInfo.isPositionAppointment == 1 && this
        			.classroomInfo.positionOrderRemark == 1) {
        			if (_this.remarkIds == "otherId" && (!_this.otherRemark || _this.otherRemark == "")) {
        				uni.showToast({
        					title: '请填写其他预约目的！',
        					icon: 'none'
        				});
        				return;
        			} else if (_this.remarkIds == '') {
        				uni.showToast({
        					title: '请选择预约目的！',
        					icon: 'none'
        				});
        				return;
        			}
        		}
        
        		// if( _this.teamName==""){
        		//  uni.showToast({title: '请填写团队名称！', icon: 'none'});
        		//  return; 
        		// }
        		//不是朗读亭
        		if (this.roomType == 1) {
        			_this.topicName = this.userName
        			_this.leaderName = this.userName
        		} else {
        			if (_this.topicName == "") {
        				uni.showToast({
        					title: '请填写预约主题！',
        					icon: 'none'
        				});
        				return;
        			}
        			
        		}
        		
        		if(this.isTeachPurpose) {
        			if(this.courseName.length === 0) {
        				uni.showToast({
        					title: '请填写课程名称', icon: 'none'
        				});
        				return;
        			}
        			if(this.courseHour.length === 0) {
        				uni.showToast({
        					title: '请填写课程学时', icon: 'none'
        				});
        				return;
        			}
        			if(this.className.length === 0) {
        				uni.showToast({
        					title: '请填写班级名称', icon: 'none'
        				});
        				return;
        			}
        			if(this.peopleNumber.length === 0) {
        				uni.showToast({
        					title: '请填写人数', icon: 'none'
        				});
        				return;
        			}
        		}
        
        		let params = {
        			token: getApp().globalData.token,
        			appId: getApp().globalData.appid,
        			teamName: _this.teamName,
        			topicName: _this.topicName,
        			leaderName: _this.leaderName,
        			fromOrderId: _this.orderId,
        			laboratoryId: _this.currLaboratoryId,
        			date: timeStr,
        			pointStr: JSON.stringify(pointArr),
        			remarks: _this.remarks,
        			remarkIds: _this.remarkIds,
        			otherRemark: _this.otherRemark,
        			isClassroomAppointment: isClassroomAppointment //整间预约  这个参数传1  如果是位置预约这个参数传0
        		};
        		
        		if(this.isTeachPurpose) {
        			params.courseName = this.courseName;
        			params.courseHour = this.courseHour;
        			params.className = this.className;
        			params.peopleNumber = this.peopleNumber;
        		}
        
        		// if(this.classroomInfo.isPositionAppointment == 1) {
        		this.$utils.requestFun('/stadium/laboratoryOrder/api/addLaboratoryOrderBatch?route=curriculum', params, 'GET').then(res => {
        			let orderId = res.data.data;
        			// #ifdef MP-WEIXIN
        			_this.sendMessage(orderId, timeStr, 2, 'uTX-t7q9g0aeD0Mf1u00Reo3kj5oYrSgcahXuNiDSbs');
        			// #endif
        
        			// #ifdef H5
        			_this.sendMessage(orderId, timeStr, 2, 'AaCEjHiO8SJxWDopn7O9YCWDm3FBT7Xo82Fm1jy0sy0');
        			// #endif
        
        		})
        		// }
        	}
        },
        sendMessage(orderId, timeStr, flag, tmplId, roomLocation = '') {
        	let _this = this;
        	// #ifdef MP-WEIXIN
        	uni.requestSubscribeMessage({
        		// tmplIds: ['uTX-t7q9g0aeD0Mf1u00Reo3kj5oYrSgcahXuNiDSbs','t3LKagU-8s_DaWO6qco9kjhqiCKwqVVAUcaKBHdJm4A'],
        		tmplIds: [tmplId],
        		complete() {
        			uni.navigateTo({
        				//url: '/pages/appointmentSuccess/appointmentSuccess?flag='+flag+'&name='+_this.classroomInfo.laboratoryName+'&time='+timeStr+'&location='+roomLocation+'&orderId='+orderId,
        				url: '/pages/appointmentInfo/appointmentInfo?orderId=' + orderId,
        			});
        		}
        	})
        	// #endif
        
        	// #ifdef H5
        	uni.redirectTo({
        		//直接跳转到详情页面
        		//url: '/pages/appointmentSuccess/appointmentSuccess?flag='+flag+'&name='+_this.classroomInfo.laboratoryName+'&time='+timeStr+'&location='+roomLocation+'&orderId='+orderId,
        		url: '/pages/appointmentInfo/appointmentInfo?orderId=' + orderId,
        
        	});
        	// #endif	
        }
		
    }
}
</script>
  
<style lang='scss' scoped>
.module-container {

    .el-radio {
        margin-bottom: 10px;
    }

    .el-dialog {
        width: 100%;

        .content {
            width: 100%;

            .time {
                display: flex;
                height: 50px;

                .title {
                    flex: 1;
                    // padding-left: 20px;
                    font-size: 18px;
                    width: 30%;

                    //  border: 1px red solid;
                    .date {
                        text-align: right;
                        font-size: 14px;
                        margin-top: 10px;
                        margin-right: 15px;
                    }

                    .text {
                        text-align: right;
                        font-size: 16px;
                        font-weight: 600;
                    }
                }

                .bar {
                    width: 70%;
                    height: 50px;
                    margin-right: 5px;
                    margin-left: 5px;

                    // border: 1px red solid;
                    .content {
                        // overflow-wrap: normal;
                        white-space: nowrap;
                        overflow-x: scroll;

                        //  display: inline-block;
                        .bob {
                            // float: left;
                            display: inline-block;
                            width: 170px;
                            color: white;
                            height: 50px;
                            margin-right: 5px;
                            background: #18cca7;
                            text-align: center;
                            box-sizing: border-box;
                            padding-top: 10px;
                            font-size: 14px;
                            border-radius: 5px;
                            margin-bottom: 3px;
                        }
                    }
                }
            }

            .el-form {
                margin-top: 50px;

                .el-form-item {
                    width: 80%;
                }
            }
        }
    }

    .dialogs {
        width: 100%;

        .details {
            .info {
                width: 100%;
                height: 100px;
                display: flex;
                justify-content: center;

                .infobox {
                    text-align: center;
                    flex: 1;
                    // border: #e6e6e6 solid 1px ;

                    // text-align: right;
                    span {
                        display: block;
                        height: 30px;
                    }

                    span.name {
                        text-align: right;
                    }

                    .week {
                        text-align: right;
                    }

                    .time {
                        text-align: right;
                    }
                }
            }
        }
    }

    .el-form-item {
        margin-bottom: 10px;
    }

    .box-card4 {
        position: fixed;
        bottom: 0px;
        // right: 0;
        z-index: 10;

        .bottoms {
            display: flex;

            width: 100%;

            .sm {
                height: 40px;
                flex: 1;
                display: flex;
                align-items: center;
                //   border:1px red solid
            }

            .gray {
                flex: 2;
                height: 40px;
                display: flex;
                align-items: center;

                .color {
                    width: 30px;
                    height: 30px;
                    background: gray;
                }

                .text {
                    margin-left: 15px;
                }
            }

            .red {
                flex: 2;
                height: 40px;
                display: flex;
                align-items: center;

                .color {
                    width: 30px;
                    height: 30px;
                    background: rgb(224, 74, 74);
                }

                .text {
                    margin-left: 15px;
                }
            }

            .green {
                flex: 2;
                height: 40px;
                display: flex;
                align-items: center;

                .color {
                    width: 30px;
                    height: 30px;
                    background: green;
                }

                .text {
                    margin-left: 15px;
                }
            }

            .blue {
                flex: 2;
                height: 40px;
                display: flex;
                align-items: center;

                .color {
                    width: 30px;
                    height: 30px;
                    background: #0099ff;
                }

                .text {
                    margin-left: 15px;
                }
            }

            .green_open {
                flex: 2;
                height: 40px;
                display: flex;
                align-items: center;

                .color {
                    width: 30px;
                    height: 30px;
                    background: #67C23A;
                }

                .text {
                    margin-left: 15px;
                }
            }
        }
    }
}

.class-table {
    .table-wrapper {
        width: 100%;
        height: 100%;
        overflow: auto;
    }

    .tabel-container {
        /* margin: 7px; */

        table {
            table-layout: fixed;
            width: 100%;
            thead {
                // background-color: #409EFF;
                background-color: #18CCA7;

                th {
                    color: #fff;
                    line-height: 17px;
                    font-weight: normal;
                }
            }

            tbody {
                background-color: #f4f4f5;

                // background-color: #fff;
                td {
                    // color: #677998;
                    color: #333;
                    line-height: 12px;
                }
            }

            th {
                width: 60px;
                padding: 0px 2px;
                font-size: 12px;
                text-align: center;
            }

            td {
                width: 60px;
                /* padding: 5px 2px; */
                font-size: 12px;
                text-align: center;
            }

            tr td:first-child {
                color: #333;

                .period {
                    font-size: 8px;
                }
            }
			 th:first-child {
			  position:sticky;
			  left:2px;
			  z-index:2;
			  background-color: #18CCA7;
			}
			td:first-child {
			  position:sticky;
			  left:2px;
			  z-index:2;
			  background-color: #f4f4f5;
			  border-right-color:#aaa;
			}
        }
    }
}
.main {
		width: 100%;
		box-sizing: border-box;
		padding-bottom: 20rpx;
		border-bottom: 1px solid #DDDDDD;
		padding-bottom: 236rpx;
	}

	.mainL {
		margin-top: 25rpx;
		width: 90rpx;

	}

	.mainL-li {
		margin-top: 20rpx;
		padding-left: 5rpx;
		padding-right: 5rpx;
		font-weight: bold;
		color: #666666;
		text-align: center;
		width: 100rpx;
		height: 60rpx;
		border-right: 1rpx solid #fff;
		border-bottom: 1rpx solid #fff;
		line-height: 60rpx;
		display: inline-block;
		font-size: 28rpx;
	}


	.mainRUl {
		margin-left: 20rpx
	}

	.mainRUl-li {
		/* margin-top: 20rpx; */
		/* width: 80rpx; */
		height: 60rpx;
		/* border-radius: 5px; */
		border-bottom: 1rpx solid #fff;
		border-right: 2rpx solid #fff;
	}

	.mainRUl-li.mainRUl-li-spel {
		font-size: 26rpx;
		line-height: 60rpx;
		color: #666;
		font-weight: 700;
	}

	.disflex-flexgrow-1 {
		-webkit-box-flex: 1;
		-moz-flex-grow: 1;
		-webkit-flex-grow: 1;
		flex: 1;
		min-width: 0;
	}

	.flex_j {
		display: -webkit-box;
		display: -moz-box;
		display: -ms-flexbox;
		display: -webkit-flex;
		display: flex;
		flex-wrap: wrap;
	}

	/*水平排列*/
	.flexH {
		-webkit-box-orient: horizontal;
		-webkit-flex-direction: row;
		-moz-flex-direction: row;
		-ms-flex-direction: row;
		-o-flex-direction: row;
		flex-direction: row;
	}

	.flexV {
		-webkit-box-orient: vertical;
		-webkit-flex-direction: column;
		-moz-flex-direction: column;
		-ms-flex-direction: column;
		-o-flex-direction: column;
		flex-direction: column;
	}

	.alignC {
		align-items: center;
		-webkit-box-align: center;
		-webkit-align-items: center;
		-moz-align-items: center;
		-ms-align-items: center;
		-o-align-items: center;
	}

	.flexC {
		-webkit-box-pack: center;
		justify-content: center;
		-webkit-justify-content: center;
		-moz-justify-content: center;
		-ms-justify-content: center;
		-o-justify-content: center;
	}

	.flexSb {
		justify-content: space-between;
		-webkit-justify-content: space-between;
		-moz-justify-content: space-between;
		-ms-justify-content: space-between;
		-o-justify-content: space-between;
	}

	.classroomAppointmentContainer {
		width: 100%;
		height: 100%;
		background: #FFFFFF;
		padding-bottom: 140rpx;
		overflow-y: scroll;
		overflow-x: hidden;
	}

	.txtOverFlow {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.flex {
		display: flex;
	}

	.noDataTxt {
		font-size: 28rpx;
		color: #999999;
		text-align: center;
		line-height: 60rpx;
	}

	.lineBox {
		width: 12rpx;
		height: 2rpx;
		background: #333;
	}

	.classRoomImg {
		width: 140rpx;
		height: 140rpx;
		margin: 30rpx 14rpx 0 34rpx;
		border-radius: 10px;
	}

	.appointmentInfoHead {
		width: 100%;
		/* height: 240rpx; */
		background-image: url("https://t.acoer.cn/guoshiBgImg/appointmentInfoBg.png");
		background-size: 100% 100%;
		background-repeat: no-repeat;
	}

	.appointmentInfoHeadBox {
		width: 69%;
	}

	.appointmentInfoHead-title {
		font-size: 34rpx;
		color: #222222;
		line-height: 58rpx;
		margin-top: 24rpx;
		font-weight: bold;
		margin-bottom: 12rpx;
	}

	.appointmentInfoHead-subTxt {
		font-size: 24rpx;
		color: #999999;
		line-height: 40rpx;
	}

	.ftc6 {
		font-size: #666666;
		margin-left: 15rpx;
	}

	.moreIconHui {
		width: 27rpx;
		height: 27rpx;
		margin-top: 90rpx;
	}

	.moreLeftIcon {
		transform: rotate(180deg);
	}

	.moreIcon {
		width: 27rpx;
		height: 27rpx;
		margin-top: 44rpx;
		margin-right: 14rpx;
	}

	.timeSwiperList {
		width: 94%;
		height: 110rpx;
		background: #F6F7F9;
		border-radius: 20rpx 20rpx 0px 0px;
		padding: 20rpx 24rpx;
	}

	.timeSwiperBox {
		width: 90%;
		overflow: hidden;
		height: 120rpx;
		white-space: nowrap;
	}

	.timeSwiperItem {
		width: 120rpx;
		height: 100rpx;
		background: #FFFFFF;
		border-radius: 10rpx;
		display: inline-block;
		margin-right: 10rpx;
		font-size: 28rpx;
		color: #666666;
		line-height: 46rpx;
		text-align: center;
		padding-top: 14rpx;
	}

	.timeSwiperItem_active {
		background: #19AD78;
		color: #FFFFFF
	}

	.timeStationBox {
		width: 100%;
		min-height: 400rpx;
		overflow: scroll;
		padding-bottom: 20rpx;
		border-bottom: 1px solid #DDDDDD;
		padding-bottom: 236rpx;
	}

	.timeBox {
		width: 130rpx;
		display: inline-table;
		border-right: 1px solid #DDDDDD;
	}

	.timeBox2 {
		width: 130rpx;
		display: inline-table;
		/* border-right: 1px solid #DDDDDD; */
	}

	.timeTxtInfo {
		margin-top: -18rpx;
	}

	.timeTxt {
		font-size: 26rpx;
		font-weight: bold;
		color: #666666;
		text-align: center;
		width: 98rpx;
		height: 62rpx;
		margin-left: -98rpx;
		margin-bottom: 6rpx;
		margin-top: 2rpx;
		line-height: 2rpx;
	}

	.timeTxt2 {
		width: 150rpx;
		font-size: 26rpx;
		font-weight: bold;
		color: #666666;
		text-align: right;
		height: 60rpx;
		line-height: 18rpx;
		margin-right: 24rpx;
	}

	.stationBox {
		width: 83%;
		height: 100%;
	}

	.stationTxt {
		/* min-width: 120rpx; */
		text-align: center;
		font-size: 24rpx;
		font-weight: bold;
		color: #666666;
		line-height: 78rpx;
		/* margin-right: 10rpx; */
		position: absolute;
		height: 70rpx;
		background: #fff;
	}

	.stationTimeBox {
		margin-right: 20rpx;
		min-width: 120rpx;
		position: relative;
	}

	.stationItemBox {
		width: 100%;
		padding-top: 72rpx;
	}

	.stationItem {
		width: 98rpx;
		height: 60rpx;
		background: #EBEBEB;
		border-radius: 10rpx;
		margin-left: 18rpx;
		margin-bottom: 6rpx;
		margin-top: 5rpx;
	}

	.stationTimeItem {
		width: 93%;
		height: 60rpx;
		background: #EBEBEB;
		border-radius: 10rpx;
		margin: 22rpx 24rpx 0rpx 0rpx;
	}

	.tipsBox {
		width: 100%;
		background: #FFFFFF;
		height: 80rpx;
		line-height: 80rpx;
	}

	.tipsTxt {
		width: 200rpx;
		font-size: 28rpx;
		color: #222222;
		text-align: center;
	}

	.tipsItem {
		width: 23%;
		text-align: left;
		font-size: 28rpx;
		color: #222222;
	}

	.tipsColor {
		width: 36rpx;
		height: 36rpx;
		border-radius: 6rpx;
		margin-top: 24rpx;
		margin-right: 14rpx;
	}

	/* 变为： 可选 灰，已约 橙，开放： #70CC33，已选： #2BD56F #19AD78 */
	.tipsGreen {
		background: #19AD78;
	}

	.tipsOrange {
		background: #8B8878;
	}

	.tipsHui {
		background: #43b673;
	}

	.tipsOpen {
		background: #FFC125;
	}

	.selectedTimeBox {
		width: 94%;
		padding: 0 27rpx;
		height: 140rpx;
		overflow: scroll;
		background-color: #F6F6F6;
	}

	.selectedTimeTxt {
		font-size: 26rpx;
		color: #666666;
		margin-top: 19rpx;
		margin-bottom: 14rpx;
	}

	.selectedTimeItem {
		width: 166rpx;
		height: 70rpx;
		background: #FF7633;
		border-radius: 10rpx;
		font-size: 24rpx;
		color: #FFFFFF;
		line-height: 32rpx;
		text-align: center;
		float: left;
		margin-right: 10rpx;
		margin-bottom: 10px;
	}

	.footer-tips {
		width: 100%;
		/* position: fixed; */
		margin-bottom: 126rpx;
	}

	.submitBtnBox {
		width: 100%;
		background-color: #FFFFFF;
		height: 130rpx;
		position: fixed;
		bottom: -1px;
		z-index: 3;
	}

	.submitBtn {
		width: 95%;
		height: 77rpx;
		background: linear-gradient(90deg, #19AD78, #1EBE85);
		border-radius: 35rpx;
		line-height: 77rpx;
		display: block;
		margin: 0 auto;
		font-size: 32rpx;
		color: #FFFFFF;
		margin-top: 20rpx;
		margin-bottom: 20rpx;
		text-align: center;
	}

	.appointmentInfoBox {
		width: 100%;
		padding-top: 85rpx;
	}

	.appointmentInfoSubTxt {
		margin-top: 32rpx;
		text-align: center;
		font-size: 30rpx;
		color: #666666;
	}

	.appointmentInfoState {
		width: 170rpx;
		height: 60rpx;
		line-height: 60rpx;
		background: #FFEEE7;
		border-radius: 4rpx;
		font-size: 30rpx;
		color: #FF072A;
		text-align: center;
		display: block;
		margin: 0 auto;
		margin-top: 46rpx;
		margin-bottom: 36rpx;
	}

	.stateGreen {
		background: #D1F4E7;
		color: #19AD78;
	}

	.stateRed {
		background: #FFEEE7;
		color: #FF072A;
	}

	.stateOrange {
		background: #FFF3E7;
		color: #FF7607;
	}

	.appointmentInfoNum {
		font-size: 32rpx;
		color: #222222;
		text-align: center;
		margin-bottom: 36rpx;
	}

	::-webkit-scrollbar {
		display: none;
	}

	.bgWhiteSquare {
		width: 130rpx;
		height: 60rpx;
		background: #fff;
		position: absolute;
	}

	.popBox {
		width: 84%;
		margin-left: 4%;
		border-radius: 20rpx;
		padding: 40rpx 30rpx;
		background: #FFFFFF;
	}

	.popTextArea {
		border: 1px solid #bbb;
		border-radius: 10rpx;
		margin-bottom: 20rpx;
		padding: 20rpx;
		width: 95%;
	}

	.popBtn {
		width: 180rpx;
		height: 60rpx;
		line-height: 60rpx;
		background: linear-gradient(90deg, #19AD78, #1EBE85);
		border-radius: 30rpx;
		text-align: center;
		font-size: 26rpx;
		color: #FFFFFF;
	}

	.popTitle {
		width: 100%;
		height: 60rpx;
		line-height: 60rpx;
		text-align: center;
		font-size: 36rpx;
		font-weight: bold;
		color: #333333;
	}

	.radioLabel {
		line-height: 46rpx;
		margin-bottom: 20px;
		font-size: 30rpx;
		float: left;
		width: 45%;
	}

	.uni-radio-input.uni-radio-input-checked {
		font: normal normal normal 14px/1 uni;
		font-size: 14px;
		content: " " !important;
		color: #fff;
		font-size: 18px;
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -48%) scale(.73);
		-webkit-transform: translate(-50%, -48%) scale(.73);
	}
</style>
  